bitkeeper revision 1.546 (3fa28f7diGvQF9o2YySrbVIsTMQmdw)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 31 Oct 2003 16:36:13 +0000 (16:36 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 31 Oct 2003 16:36:13 +0000 (16:36 +0000)
current.h, entry.S:
  Correct stack arithmetic when esp is not a multiple of 4 (eg. in the middle of skanky pcibios code).

xen/arch/i386/entry.S
xen/include/asm-i386/current.h

index 77ad757d6235054874a7d5479a96b65cc7541a66..953a2fe03d93cdae5084ae8c485882b9b80551ff 100644 (file)
@@ -161,7 +161,8 @@ NT_MASK             = 0x00004000
 #define GET_CURRENT(reg)   \
         movl $4096-4, reg; \
         orl  %esp, reg;    \
-        movl (reg),reg     \
+        andl $~3,reg;      \
+        movl (reg),reg;
 
 ENTRY(continue_nonidle_task)
         GET_CURRENT(%ebx)
index 5a12a1201f56894abb9d3a449d5c2d529b33e606..c2d29857889cd0b2de4642433ae2cd1890b6b221 100644 (file)
@@ -6,7 +6,7 @@ struct task_struct;
 static inline struct task_struct * get_current(void)
 {
     struct task_struct *current;
-    __asm__ ( "orl %%esp,%0; movl (%0),%0" 
+    __asm__ ( "orl %%esp,%0; andl $~3,%0; movl (%0),%0" 
               : "=r" (current) : "0" (4092UL) );
     return current;
 }
@@ -15,7 +15,7 @@ static inline struct task_struct * get_current(void)
 
 static inline void set_current(struct task_struct *p)
 {
-    __asm__ ( "orl %%esp,%0; movl %1,(%0)" 
+    __asm__ ( "orl %%esp,%0; andl $~3,%0; movl %1,(%0)" 
               : : "r" (4092UL), "r" (p) );    
 }
 
@@ -30,7 +30,7 @@ static inline execution_context_t *get_execution_context(void)
 static inline unsigned long get_stack_top(void)
 {
     unsigned long p;
-    __asm__ ( "orl %%esp,%0" 
+    __asm__ ( "orl %%esp,%0; andl $~3,%0
               : "=r" (p) : "0" (4092UL) );
     return p;
 }